package com.aikon.wht.multiThread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author haitao.wang
 *
 */
public class TestOfThreadPool {

	private Executor threadPoolExecutor = new ThreadPoolExecutor(10, 20, 10, TimeUnit.SECONDS,
			new ArrayBlockingQueue(10));

	class thread1 implements Runnable {

		public thread1(String string) {

		}

		public void run() {
			Integer i = 0;
			while (i < Integer.MAX_VALUE) {
				System.out.println(i);
				i++;
			}
		}

	}

	class thread2 implements Runnable {

		public void run() {
			
			System.out.println("/n");
		}

	}

	public static void main(String[] args) {
		TestOfThreadPool testOfThreadPool = new TestOfThreadPool();
		testOfThreadPool.go();
	}

	public void go() {
		threadPoolExecutor.execute(new thread1("xx"));
		threadPoolExecutor.execute(new thread2());
	}

}
